from django.urls import path
from apps.users.views import UsernameCountView, RegisterView, LoginView, LogoutView, UserCenterView, EmailView
from apps.users.views import EmailVerificationView
from apps.users.views import CreateAddressView, AddressListView
from apps.users.views import UserHistoryView

urlpatterns = [
    # TODO 判断用户名是否重复
    # TODO 通过 <变量名> 来获取 请求参数
    path('usernames/<usercount:username>/count/', UsernameCountView.as_view()),

    # TODO 注册
    path('register/', RegisterView.as_view()),

    # TODO 登录
    path('login/', LoginView.as_view()),

    # TODO 退出登录
    path('logout/', LogoutView.as_view()),

    # TODO 个人中心
    path('info/', UserCenterView.as_view()),

    # TODO 更新[保存]邮箱信息
    path('emails/', EmailView.as_view()),

    # TODO 邮件激活
    path('emails/verification/', EmailVerificationView.as_view()),

    # TODO 新增收货地址
    path('addresses/create/', CreateAddressView.as_view()),

    # TODO 获取收货地址
    path('addresses/', AddressListView.as_view()),

    # TODO 新增用户浏览记录
    path('browse_histories/', UserHistoryView.as_view()),
]
